package com.example.sport.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.sport.domain.AthleteEventResult;
import com.example.sport.domain.CollegeRankAndPoints;
import com.example.sport.domain.EventResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface JudgeMapper extends BaseMapper<CollegeRankAndPoints> {
    @Select({
            "<script>",
            "SELECT",
            "co.id AS id,",
            "co.name AS collegeName,",
            "co.leader AS leader,",
            "cr.total_points AS totalPoints,",
            "cr.total_rank AS totalRank",
            "FROM",
            "t_college co",
            "JOIN",
            "college_ranking cr ON co.id = cr.college_id",
            "<where>",
            "  <if test='collegeName != null and collegeName.trim() != \"\"'>",
            "      co.name LIKE CONCAT('%', #{collegeName}, '%')",
            "  </if>",
            "</where>",
            "</script>"
    })
    List<CollegeRankAndPoints> getCollegeRankAndPointsByCollegeName(String collegeName);



}
